UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kHfLaHSMuz7NgTh2R2qa5x40D3NGhXiUy4n7xPt1U5o='
WHERE
key_id = 'e8049a3e016da928ccbd9551c1169034e91a294884a45c282a621d3dd779dc2a'
AND (
token = 'kHfLaHSMuz7NgTh2R2qa5x40D3NGhXiUy4n7xPt1U5o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)