UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O0jqjABYahttfD12aFSdDZhAGiovYXCc9nEjE0YS9tk=' 
WHERE 
  key_id = '48c46242241598831797dd19aa83fb71419d8a7f93ff09fe7f3cee080940f39d' 
  AND (
    token = 'O0jqjABYahttfD12aFSdDZhAGiovYXCc9nEjE0YS9tk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049