UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'brNrDLP0v+NdMm5V1zk7PDaOCcsBE1NVx2jYRE7pFYk=' 
WHERE 
  key_id = '896073f8a7bd56df99e63128bdf21b97efcbe998a1740ffbd06779d2135bac71' 
  AND (
    token = 'brNrDLP0v+NdMm5V1zk7PDaOCcsBE1NVx2jYRE7pFYk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021