UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tPV0cKpm5WFXq5w3rlytX1IkB0l3d2CYYbXhPcLnIBQ=' 
WHERE 
  key_id = '27c9e2d9590288e30c4481389acb535c14305a0174ff4ed7b3554144579925f9' 
  AND (
    token = 'tPV0cKpm5WFXq5w3rlytX1IkB0l3d2CYYbXhPcLnIBQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047