UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 's8qk42ndsbCffmNxk9+tsF70fsH4b14Lza273hRQ7xo='
WHERE
key_id = 'b8d3f72baf5f90d2079b2d682a1e9b154f1192d751211d49e567116690968b77'
AND (
token = 's8qk42ndsbCffmNxk9+tsF70fsH4b14Lza273hRQ7xo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)