UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'q4+bt6TmiGVuhg5fDWKeknuquQ8eekPUSOkxSKLmHnk='
WHERE
key_id = 'afad0043a4488df1e3a4c062de9ab550dd524e9116670fccb1a78affef4d2de0'
AND (
token = 'q4+bt6TmiGVuhg5fDWKeknuquQ8eekPUSOkxSKLmHnk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)