UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w48e42m95xmANhrSQvN+MM/kKEClcogje2FOZ/cg/k8=' 
WHERE 
  key_id = '0aa63e727d8afa4870b45afd29727f08106bfdc3fae912c339d05843f0621b11' 
  AND (
    token = 'w48e42m95xmANhrSQvN+MM/kKEClcogje2FOZ/cg/k8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042