UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Dc45bgT3FSJFP/6akH6NO63oPch7zbXrn2JUO7ApTLU=' 
WHERE 
  key_id = 'd412c32a2d12f269c71b20d233a0662bdaa56ee716ff2ef8d43bb993b451a5b6' 
  AND (
    token = 'Dc45bgT3FSJFP/6akH6NO63oPch7zbXrn2JUO7ApTLU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028