UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CoTJjDA+i1lXM5E4Z0TP90YZf6gFAvcD8fAPLFXZN+Q=' 
WHERE 
  key_id = '6b655c619ed2669d1f3f9116af8b5b57d183953aef57ce5d10e7f6d3a3a06476' 
  AND (
    token = 'CoTJjDA+i1lXM5E4Z0TP90YZf6gFAvcD8fAPLFXZN+Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034