UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6s7OuIztOUA596UilKu0ImuNuQKFbK32R2l+uI2Eli4=' 
WHERE 
  key_id = '4c4370c27a33f322771a42fba5467378c122ec0091c0918a4bdedcfa4d729d50' 
  AND (
    token = '6s7OuIztOUA596UilKu0ImuNuQKFbK32R2l+uI2Eli4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037