UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vcPnzAV0xNdyIMpCP0xhzANX+eoXfJPXuSlfRuqd2aY=' 
WHERE 
  key_id = 'd294c8b939895bef5f644a462b5556b6d65d1fcced21b5b2c2b93442301aa2aa' 
  AND (
    token = 'vcPnzAV0xNdyIMpCP0xhzANX+eoXfJPXuSlfRuqd2aY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026