UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uVwAdPPX45a7beotdnctGM3ImhxfSnggzikLAVT3890='
WHERE
key_id = 'e82324813fa80176592efb1c64da31299e93f7177fc9602ba91066d961e59fc5'
AND (
token = 'uVwAdPPX45a7beotdnctGM3ImhxfSnggzikLAVT3890='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)