UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M20+YxJWtV2HQgSUX+0IUfzJ48yipud9gcGj6fM515A=' 
WHERE 
  key_id = '424119ba042e686a42817c346140468dff9479df3601fb7c4e7363b326c635fa' 
  AND (
    token = 'M20+YxJWtV2HQgSUX+0IUfzJ48yipud9gcGj6fM515A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019