UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v7WywqKLtD3ecfU3m9douEC7LYY3zrB5WVxuAhZgjvU=' 
WHERE 
  key_id = '2fe050fd35e094de69add6226bc9e30383631ec18cfaafc7a672d8579412af79' 
  AND (
    token = 'v7WywqKLtD3ecfU3m9douEC7LYY3zrB5WVxuAhZgjvU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019