UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SjS+YsQ4lBG08nvpj9RorTEbmprIjg7chXftpRbHMPk=' 
WHERE 
  key_id = '6bca89d219e20270c3b2fb7c49b3e8249e7be13a936577ec89347452eb2f7d88' 
  AND (
    token = 'SjS+YsQ4lBG08nvpj9RorTEbmprIjg7chXftpRbHMPk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034