UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XTU0zyFlbXfs0YMN+0wm+fRQ81d+EbTxv1/R4dUErF8=' 
WHERE 
  key_id = 'fedf57cd43b1b351526c13b7cfdbbda497e724a5d28cd3a048d43330be7ff29f' 
  AND (
    token = 'XTU0zyFlbXfs0YMN+0wm+fRQ81d+EbTxv1/R4dUErF8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026