UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ujYO+gDLAtOByTM9s9YDIsZxwd9o6Hsf2Kd5ffK7XWk=' 
WHERE 
  key_id = '654172c58e24ea542cd620523f4736644e0731ba313bf73ca5719fab1df7a163' 
  AND (
    token = 'ujYO+gDLAtOByTM9s9YDIsZxwd9o6Hsf2Kd5ffK7XWk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059