UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kKET+VXRQ3lLyZBw1MEd+eJZ9C+X+G5vlYwoxk+c918='
WHERE
key_id = '016ddd570139edf33d9b9972eaf47822aa78615b2093a099224a29ac5d353720'
AND (
token = 'kKET+VXRQ3lLyZBw1MEd+eJZ9C+X+G5vlYwoxk+c918='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)