UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YPZLOo1z/qmMbi0r9c7mtUwBGLFubiH2Gntvw8L2tk0=' 
WHERE 
  key_id = '1015696065805bf9ccbe9206d52df58d5215d00b2d1176536dffab039a69df0c' 
  AND (
    token = 'YPZLOo1z/qmMbi0r9c7mtUwBGLFubiH2Gntvw8L2tk0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041