UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PGo5PgMMY/UM22KkkgJ/T+IlPJp1ak8Dllck30bytQY='
WHERE
key_id = 'b6dfdefd2e2805fc3f34215f774581ad1b072a3964e5dd8a5154158d58ce6366'
AND (
token = 'PGo5PgMMY/UM22KkkgJ/T+IlPJp1ak8Dllck30bytQY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)