UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KMgjbWnk28FvtuvOODj8qkKMAgO0OxZOTfrAbb9hcGI='
WHERE
key_id = '78f95cbd138236f0c0db99dbf6930abed7ade430e69b7b777151766af75b6cc5'
AND (
token = 'KMgjbWnk28FvtuvOODj8qkKMAgO0OxZOTfrAbb9hcGI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)