UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ibq/gGRM2oCpj/VKfVNcKFyQLN3bv1UgGrnL7/rwD1Y=' 
WHERE 
  key_id = '4f6b27b85817bd761cee891246cb1834382c1ff131022de6e16e5a1c4b840a56' 
  AND (
    token = 'Ibq/gGRM2oCpj/VKfVNcKFyQLN3bv1UgGrnL7/rwD1Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030