UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2TTw1CsMPTNiiYRmG0G8J7gaLu5DYu2s3Iy6iBA366c='
WHERE
key_id = '308bcd61bcdabca1e70e7c6f6ff1266990acdc0c47dd8fa280a73aa3fd1615ae'
AND (
token = '2TTw1CsMPTNiiYRmG0G8J7gaLu5DYu2s3Iy6iBA366c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)