UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7eT+IemwDCGlKpDBHDcLVjzeiW3yowe+t3gWl54+l1U='
WHERE
key_id = '0e381b26ef0204ac115b4e705cc128c7330eb47b862d608245597ede5a7f09e7'
AND (
token = '7eT+IemwDCGlKpDBHDcLVjzeiW3yowe+t3gWl54+l1U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)