UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CjMv4SakkBrtCLrnvccTGsRpNB0DXuvbOFKElPcpBNY=' 
WHERE 
  key_id = '842178f5783c1f47f35210cd66658184efc2e741a06a3f16214d48f60cef20f9' 
  AND (
    token = 'CjMv4SakkBrtCLrnvccTGsRpNB0DXuvbOFKElPcpBNY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051