UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P4n7nBuwwQ7cWXw5o3obS/3x+15KgiWCYLgY8XKF+ZA='
WHERE
key_id = '5a77ba179536dbee5bb6a24a8ba6f4142769a006d56990739476b9c2fc722c60'
AND (
token = 'P4n7nBuwwQ7cWXw5o3obS/3x+15KgiWCYLgY8XKF+ZA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)