UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '83Z3bY8jNQ3aQpuAdaGUSGvcKFZaTRs3UAUB7DLLks8='
WHERE
key_id = '246d8e844d87ee30009637e15bd6695183dd78bd0db8d337888bb977ec3b9d9e'
AND (
token = '83Z3bY8jNQ3aQpuAdaGUSGvcKFZaTRs3UAUB7DLLks8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)