UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yyF3gp5pGJFfNKrSZMqbSpJgbmDjRRfvrMmFV3uTG8k=' 
WHERE 
  key_id = '564c2b46814f4b3735c7ac8d08ad97817acf24560dcd542194055f867e19a544' 
  AND (
    token = 'yyF3gp5pGJFfNKrSZMqbSpJgbmDjRRfvrMmFV3uTG8k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023