UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wqjNBJ/mg15XHnhTczXF0PXgdtEPbONGvhugZX4IOho=' 
WHERE 
  key_id = '96deca285950793637dda16781defa64d66b2a0b1689ec0a04aed4fa745f3fd4' 
  AND (
    token = 'wqjNBJ/mg15XHnhTczXF0PXgdtEPbONGvhugZX4IOho=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022