UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NsK7+CWYxdY1y0F0Iz+yTs45GOWPnYbF2pPKRW3iVgA='
WHERE
key_id = 'f7f7b9e65fe65be12656a340e9e48660d3b29d358930fe3d1a159cda67655028'
AND (
token = 'NsK7+CWYxdY1y0F0Iz+yTs45GOWPnYbF2pPKRW3iVgA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)