UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xuDddRC2lBletrVOGWSn+zZyy+9IF27ij8eRDATx1bI=' 
WHERE 
  key_id = '372c9115540620be7109a36e7bc134a31144c067d5ff16526dd05d6437021ec5' 
  AND (
    token = 'xuDddRC2lBletrVOGWSn+zZyy+9IF27ij8eRDATx1bI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026