UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CTwAT+jJzeafs4LjofO+bSs1IaSSI54JAE6wB6zFUIk='
WHERE
key_id = '58a227722da42e3dc6cd33d76b40edfb2f09cfce3306f400161e45cc4d4e6313'
AND (
token = 'CTwAT+jJzeafs4LjofO+bSs1IaSSI54JAE6wB6zFUIk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)