UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RJNoKBT8UvbQkPviwRZq2bdWykcZTnCr5NpuQokXlz0=' 
WHERE 
  key_id = '4c26d0820069b8d672eee5b26571f615ddbb9865b53352652c8da2e7c312a5e6' 
  AND (
    token = 'RJNoKBT8UvbQkPviwRZq2bdWykcZTnCr5NpuQokXlz0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023