UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rRttE1MLbQzIbIN6l8CT64X3Aw0DtSTEw+cyIiV+dNo='
WHERE
key_id = '9327d8e792994d12d4d489862ea69220c3000dc4a34f6cb643590e66097ae20a'
AND (
token = 'rRttE1MLbQzIbIN6l8CT64X3Aw0DtSTEw+cyIiV+dNo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)