UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r16agsR2YHWuuYSwGsEqs+aSm0UMR/RGvIhaJ2+mRSQ=' 
WHERE 
  key_id = '6ddaf7d1fd80a299f743cdb79c5d3405c389a450f5aebd3ae86eef7f13b415dc' 
  AND (
    token = 'r16agsR2YHWuuYSwGsEqs+aSm0UMR/RGvIhaJ2+mRSQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037