UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AprWUsHjH2+CMnxyiidt03NSORGRLGbiS/mFIoArf78='
WHERE
key_id = '6399fe94949f442aafaa3b022097a6df7b4ab2b4751defd239c493113a8744b4'
AND (
token = 'AprWUsHjH2+CMnxyiidt03NSORGRLGbiS/mFIoArf78='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)