UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z3gDD50mXlLgNob8m4/BtiTvsCJn6xtO6Lqf2ejyvmQ=' 
WHERE 
  key_id = '3f0bda0d1e578cc6a60389c3611a7f34e85176562520f590640567969d6bc5b4' 
  AND (
    token = 'z3gDD50mXlLgNob8m4/BtiTvsCJn6xtO6Lqf2ejyvmQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042