UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+rGc/1Jdiekbrg/EbXf7fwsjArdzDC7Q+8Ly1OGVxs8=' 
WHERE 
  key_id = '9d998142e991c9f52ea71e815e139935187d2daf77f108888314ab0e456dd967' 
  AND (
    token = '+rGc/1Jdiekbrg/EbXf7fwsjArdzDC7Q+8Ly1OGVxs8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037