UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SICgk/oO0D1XR6EFIyux4xhFfThY1Zq15Gzh4ZXAQeU='
WHERE
key_id = 'b047a8031ada99809441a5c76065ae4df164f2831b2601285c06b367043c0489'
AND (
token = 'SICgk/oO0D1XR6EFIyux4xhFfThY1Zq15Gzh4ZXAQeU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)