UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GWtF17brLUCTZSnsakZ3ZtH5tYMjedEBvK2rHIs3PjY='
WHERE
key_id = '58977fadd8f4e4f9a85b6426f290f9a1bac6a5c472289d668efce5a2a8fcca16'
AND (
token = 'GWtF17brLUCTZSnsakZ3ZtH5tYMjedEBvK2rHIs3PjY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)