UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KaB5W7q2cFph29AQ6N5qAnHS3UD7HC5tGRaSnQkHxaw='
WHERE
key_id = '732dfd2a667a534478a58a17d0cc74b0558f115513d990b7a1477088342d60d5'
AND (
token = 'KaB5W7q2cFph29AQ6N5qAnHS3UD7HC5tGRaSnQkHxaw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)