UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q0t1ZqRZ+JiY62qPUPm1pPpCOwpfXXW3INw0rkG1WW4=' 
WHERE 
  key_id = '92c03b9caffcd481691b035cce1d3c9f13a82e63f2f66146fac460c1e5fa2aba' 
  AND (
    token = 'q0t1ZqRZ+JiY62qPUPm1pPpCOwpfXXW3INw0rkG1WW4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024