UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lAAXZc9HE9QXUA6btom7ltpKs6joOSbWxy0aY44ri78=' 
WHERE 
  key_id = 'f0ced6018e7247e8ac06c862cd74667b564bb3d79676f5796f2e540accec8e98' 
  AND (
    token = 'lAAXZc9HE9QXUA6btom7ltpKs6joOSbWxy0aY44ri78=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040