UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7fPtUTKD1dnu+2uYFPqCOpyY5ZeQl8gytSSjI1E9z48='
WHERE
key_id = '3b880a61406d4054cf7f4ba34fd491f50d2b62fa7b55e2ddbe329d4eba566696'
AND (
token = '7fPtUTKD1dnu+2uYFPqCOpyY5ZeQl8gytSSjI1E9z48='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)