UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'W9TMZgCU3r5GnMCmrwfOytpRju8c2OkHwDBIXY5Scos='
WHERE
key_id = 'e3d8028d656222fed4f2c094b68b268d1a27a3de977369dc70d466a2851c29ab'
AND (
token = 'W9TMZgCU3r5GnMCmrwfOytpRju8c2OkHwDBIXY5Scos='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)