UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i882JpngKNlbIL++vcf7wuLLAwKzqkraOIiEZVUHQT8='
WHERE
key_id = '0e6b863acc61f557b06520c47316b52b3a52678f498f11ab589af0f3cddcce63'
AND (
token = 'i882JpngKNlbIL++vcf7wuLLAwKzqkraOIiEZVUHQT8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)