UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n8VB2dxcesR6XEmUIwU390Zf9QyYSoKllk/+60TzYLs='
WHERE
key_id = '8a938c595ddaaa1622fd515547a0d528e4109ba1d16c0d23de32565246c9fc30'
AND (
token = 'n8VB2dxcesR6XEmUIwU390Zf9QyYSoKllk/+60TzYLs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)