UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'phos5I/mONWjrX7vsa7TIVQ1tsKtplG7UT4/lgUiDjo='
WHERE
key_id = 'afb83e0f9416e74f3b5dc44dbadb57ec4995fc81d3cb866af313207732aa0d8a'
AND (
token = 'phos5I/mONWjrX7vsa7TIVQ1tsKtplG7UT4/lgUiDjo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)