UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '58g7SizGnH9UpXpLtRjx7y/RP8efqTkDzQkeOQ3SoV0='
WHERE
key_id = '1f6520be88012b7117916a60ffef0b2fd38c9fc4bf0d45e8c82d86814caf7eba'
AND (
token = '58g7SizGnH9UpXpLtRjx7y/RP8efqTkDzQkeOQ3SoV0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)